<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"
    %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>新增場地資料</title>
</head>
<body>
<% if(session.getAttribute("access") == "y" ){%>
<jsp:useBean id="mydb" scope="page" class="bean.ConDbBean"/> <%//連結資料庫的bean %>
<%
String pid = new String(request.getParameter("id").getBytes("iso-8859-1"),"utf-8"); //防止亂碼
String pname=new String(request.getParameter("name").getBytes("iso-8859-1"),"utf-8");
String person=new String(request.getParameter("person").getBytes("iso-8859-1"),"utf-8");
String pps= new String(request.getParameter("ps").getBytes("iso-8859-1"),"utf-8");
String pclass= new String(request.getParameter("class").getBytes("iso-8859-1"),"utf-8");

String pair =new String(request.getParameter("air").getBytes("iso-8859-1"),"utf-8");
String pdea=new String(request.getParameter("deafening").getBytes("iso-8859-1"),"utf-8");
String pacou=new String(request.getParameter("acoustics").getBytes("iso-8859-1"),"utf-8");
String mir=new String(request.getParameter("mir").getBytes("iso-8859-1"),"utf-8");
String scr=new String(request.getParameter("screen").getBytes("iso-8859-1"),"utf-8");
String pro=new String(request.getParameter("projector").getBytes("iso-8859-1"),"utf-8");
String light=new String(request.getParameter("light").getBytes("iso-8859-1"),"utf-8");
String wire=new String(request.getParameter("wireless").getBytes("iso-8859-1"),"utf-8");
String lcd=new String(request.getParameter("lcd").getBytes("iso-8859-1"),"utf-8");



//java.net.URLEncoder.encode(keyword,"UTF-8") 丟出中文字串的寫法
String sql="INSERT INTO PLACE(P_ID,P_NAME,P_STATE,PERSON,PS,P_CLASS,AIR,DEAFENING,ACOUSTICS,MIR,SCREEN,PROJECTOR,LIGHT,WIRELESS,LCD) VALUES('"+pid+"','"+pname+"','00','"+person+"','"+pps+"','"+pclass+"','"+pair+"','"+pdea+"','"+pacou+"','"+mir+"','"+scr+"','"+pro+"','"+light+"','"+wire+"','"+lcd+"')";
mydb.executeInsert(sql);
response.sendRedirect("lookPlace.jsp"); //直接跳頁到lookPlace.jsp
%>
<%
  }
  else{
  	response.sendRedirect("../index.jsp"); //若沒有登入則回到index.jsp
  } 
  %>
</body>
</html>